package com.jintu.portal.utils;

import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by liyou on 2017/9/18.
 */
public class SmsUtil {

    private static final Logger logger = LoggerFactory.getLogger(SmsUtil.class);
    /**
     * 发送短信
     * @param phone
     * @param msgType
     * @param params
     * @return
     * @throws Exception
     */
    public static Boolean send(String phone, MsgTypeInterface msgType, String... params) throws Exception {
        boolean result = false;
        logger.info("phone=:"+phone+"  msgType=:"+msgType);
        SendSmsResponse response = AliSmsUtil.sendSms(phone,msgType,params);
        if(response != null && "OK".equals(response.getCode())) {
            result = true;
        }

        return result;
    }


}
